.class public Lcom/glympse/android/glympse/ViewSearch;
.super Landroid/widget/LinearLayout;
.source "ViewSearch.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/glympse/android/glympse/ViewSearch$MyGlympseView;,
        Lcom/glympse/android/glympse/ViewSearch$OnClickSearch;,
        Lcom/glympse/android/glympse/ViewSearch$OnItemClickSearch;,
        Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;,
        Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;,
        Lcom/glympse/android/glympse/ViewSearch$PlaceItem;,
        Lcom/glympse/android/glympse/ViewSearch$PlacesAdapter;,
        Lcom/glympse/android/glympse/ViewSearch$SearchAutoCompleteAdapter;,
        Lcom/glympse/android/glympse/ViewSearch$SearchResultAdapter;
    }
.end annotation


# static fields
.field public static final KIND_FAVORITE:I = 0x1

.field public static final KIND_POSTAL:I = 0x2


# instance fields
.field private m_fAddressSearch:Z

.field private m_fSearchRunning:Z

.field private m_oButtonSearch:Landroid/widget/ImageButton;

.field private m_oEditSearch:Landroid/widget/AutoCompleteTextView;

.field public m_oGlympseView:Lcom/glympse/android/glympse/ViewSearch$MyGlympseView;

.field private m_oListResults:Landroid/widget/ListView;

.field private m_oOnTextChangedListenerSearch:Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;

.field private m_oTextEmpty:Landroid/widget/TextView;

.field public m_strInitialText:Ljava/lang/String;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 3
    .parameter "oContext"

    .prologue
    const/4 v2, 0x0

    const/4 v1, 0x0

    .line 67
    invoke-direct {p0, p1}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;)V

    .line 49
    new-instance v0, Lcom/glympse/android/glympse/ViewSearch$MyGlympseView;

    invoke-direct {v0, p0}, Lcom/glympse/android/glympse/ViewSearch$MyGlympseView;-><init>(Lcom/glympse/android/glympse/ViewSearch;)V

    iput-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oGlympseView:Lcom/glympse/android/glympse/ViewSearch$MyGlympseView;

    .line 54
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_strInitialText:Ljava/lang/String;

    .line 55
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    .line 56
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oButtonSearch:Landroid/widget/ImageButton;

    .line 57
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    .line 58
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oTextEmpty:Landroid/widget/TextView;

    .line 59
    iput-boolean v2, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fSearchRunning:Z

    .line 60
    iput-boolean v2, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fAddressSearch:Z

    .line 62
    iput-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oOnTextChangedListenerSearch:Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;

    .line 68
    return-void
.end method

.method private StartSearch(Ljava/lang/String;)V
    .locals 5
    .parameter "strAddress"

    .prologue
    const/4 v4, 0x0

    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 188
    iget-boolean v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fSearchRunning:Z

    if-nez v1, :cond_0

    .line 190
    if-nez p1, :cond_1

    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    invoke-virtual {v1}, Landroid/widget/AutoCompleteTextView;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    move-object v0, v1

    .line 191
    .local v0, strSearch:Ljava/lang/String;
    :goto_0
    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v1

    if-lez v1, :cond_0

    .line 193
    iput-boolean v3, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fSearchRunning:Z

    .line 194
    if-eqz p1, :cond_2

    move v1, v3

    :goto_1
    iput-boolean v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fAddressSearch:Z

    .line 195
    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    invoke-virtual {v1}, Landroid/widget/AutoCompleteTextView;->dismissDropDown()V

    .line 196
    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    invoke-virtual {v1, v2}, Landroid/widget/AutoCompleteTextView;->setEnabled(Z)V

    .line 197
    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oButtonSearch:Landroid/widget/ImageButton;

    invoke-virtual {v1, v2}, Landroid/widget/ImageButton;->setEnabled(Z)V

    .line 199
    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oTextEmpty:Landroid/widget/TextView;

    const v2, 0x7f0a0048

    invoke-virtual {v1, v2}, Landroid/widget/TextView;->setText(I)V

    .line 200
    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    invoke-virtual {v1, v4}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 201
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v1

    new-instance v2, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;

    invoke-direct {v2, p0}, Lcom/glympse/android/glympse/ViewSearch$OnSearchCompleted;-><init>(Lcom/glympse/android/glympse/ViewSearch;)V

    invoke-virtual {v1, v0, v4, v2}, Lcom/glympse/platform/Platform;->StartSearch(Ljava/lang/String;Lcom/glympse/platform/common/LocPoint;Lcom/glympse/platform/common/SearchResultsListener;)Z

    .line 204
    .end local v0           #strSearch:Ljava/lang/String;
    :cond_0
    return-void

    .line 190
    :cond_1
    invoke-virtual {p1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    move-object v0, v1

    goto :goto_0

    .restart local v0       #strSearch:Ljava/lang/String;
    :cond_2
    move v1, v2

    .line 194
    goto :goto_1
.end method

.method private UpdateSearchButton()V
    .locals 2

    .prologue
    .line 182
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oButtonSearch:Landroid/widget/ImageButton;

    iget-boolean v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fSearchRunning:Z

    if-nez v1, :cond_0

    iget-object v1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    invoke-virtual {v1}, Landroid/widget/AutoCompleteTextView;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    if-lez v1, :cond_0

    const/4 v1, 0x1

    :goto_0
    invoke-virtual {v0, v1}, Landroid/widget/ImageButton;->setEnabled(Z)V

    .line 183
    return-void

    .line 182
    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method

.method static synthetic access$0(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/AutoCompleteTextView;
    .locals 1
    .parameter

    .prologue
    .line 55
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    return-object v0
.end method

.method static synthetic access$1(Lcom/glympse/android/glympse/ViewSearch;Landroid/widget/AutoCompleteTextView;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 55
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oEditSearch:Landroid/widget/AutoCompleteTextView;

    return-void
.end method

.method static synthetic access$10(Lcom/glympse/android/glympse/ViewSearch;)V
    .locals 0
    .parameter

    .prologue
    .line 180
    invoke-direct {p0}, Lcom/glympse/android/glympse/ViewSearch;->UpdateSearchButton()V

    return-void
.end method

.method static synthetic access$11(Lcom/glympse/android/glympse/ViewSearch;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 186
    invoke-direct {p0, p1}, Lcom/glympse/android/glympse/ViewSearch;->StartSearch(Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$12(Lcom/glympse/android/glympse/ViewSearch;)Z
    .locals 1
    .parameter

    .prologue
    .line 60
    iget-boolean v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fAddressSearch:Z

    return v0
.end method

.method static synthetic access$13(Lcom/glympse/android/glympse/ViewSearch;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 59
    iput-boolean p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fSearchRunning:Z

    return-void
.end method

.method static synthetic access$14(Lcom/glympse/android/glympse/ViewSearch;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 60
    iput-boolean p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_fAddressSearch:Z

    return-void
.end method

.method static synthetic access$2(Lcom/glympse/android/glympse/ViewSearch;Landroid/widget/ImageButton;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 56
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oButtonSearch:Landroid/widget/ImageButton;

    return-void
.end method

.method static synthetic access$3(Lcom/glympse/android/glympse/ViewSearch;Landroid/widget/ListView;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 57
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    return-void
.end method

.method static synthetic access$4(Lcom/glympse/android/glympse/ViewSearch;Landroid/widget/TextView;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 58
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oTextEmpty:Landroid/widget/TextView;

    return-void
.end method

.method static synthetic access$5(Lcom/glympse/android/glympse/ViewSearch;Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 62
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oOnTextChangedListenerSearch:Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;

    return-void
.end method

.method static synthetic access$6(Lcom/glympse/android/glympse/ViewSearch;)Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;
    .locals 1
    .parameter

    .prologue
    .line 62
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oOnTextChangedListenerSearch:Lcom/glympse/android/glympse/ViewSearch$OnTextChangedListenerSearch;

    return-object v0
.end method

.method static synthetic access$7(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/ImageButton;
    .locals 1
    .parameter

    .prologue
    .line 56
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oButtonSearch:Landroid/widget/ImageButton;

    return-object v0
.end method

.method static synthetic access$8(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/ListView;
    .locals 1
    .parameter

    .prologue
    .line 57
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    return-object v0
.end method

.method static synthetic access$9(Lcom/glympse/android/glympse/ViewSearch;)Landroid/widget/TextView;
    .locals 1
    .parameter

    .prologue
    .line 58
    iget-object v0, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oTextEmpty:Landroid/widget/TextView;

    return-object v0
.end method


# virtual methods
.method protected BuildFavorites()V
    .locals 6

    .prologue
    const/4 v5, 0x0

    .line 156
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 158
    .local v0, listPlaceItems:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/glympse/android/glympse/ViewSearch$PlaceItem;>;"
    sget-object v3, Lcom/glympse/android/glympse/Glympse;->ms_oThis:Lcom/glympse/android/glympse/Glympse;

    iget-object v3, v3, Lcom/glympse/android/glympse/Glympse;->m_oViewSendGlympse:Lcom/glympse/android/glympse/ViewSendGlympse;

    invoke-virtual {v3}, Lcom/glympse/android/glympse/ViewSendGlympse;->GetDestination()Lcom/glympse/platform/common/Place;

    move-result-object v3

    invoke-virtual {v3}, Lcom/glympse/platform/common/Place;->HasLocation()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 160
    new-instance v3, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;

    sget-object v4, Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;->NoLocation:Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;

    invoke-direct {v3, v4, v5}, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;-><init>(Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;Lcom/glympse/platform/common/Place;)V

    invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 161
    new-instance v3, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;

    sget-object v4, Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;->EditExistingDestination:Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;

    invoke-direct {v3, v4, v5}, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;-><init>(Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;Lcom/glympse/platform/common/Place;)V

    invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 164
    :cond_0
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    iget-object v3, v3, Lcom/glympse/platform/Platform;->m_oLocManager:Lcom/glympse/platform/LocManager;

    iget-object v3, v3, Lcom/glympse/platform/LocManager;->m_oLastLocPoint:Lcom/glympse/platform/common/LocPoint;

    invoke-virtual {v3}, Lcom/glympse/platform/common/LocPoint;->HasLocation()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 166
    new-instance v3, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;

    sget-object v4, Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;->UseCurrentLocation:Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;

    invoke-direct {v3, v4, v5}, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;-><init>(Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;Lcom/glympse/platform/common/Place;)V

    invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 169
    :cond_1
    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    move-result-object v3

    iget-object v3, v3, Lcom/glympse/platform/Platform;->m_oPlaceList:Lcom/glympse/platform/common/PlaceList;

    iget-object v3, v3, Lcom/glympse/platform/common/PlaceList;->m_listPlaces:Lcom/glympse/platform/GVector$Places;

    invoke-virtual {v3}, Lcom/glympse/platform/GVector$Places;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-nez v4, :cond_2

    .line 174
    new-instance v2, Lcom/glympse/android/glympse/ViewSearch$PlacesAdapter;

    invoke-virtual {p0}, Lcom/glympse/android/glympse/ViewSearch;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-direct {v2, p0, v3, v0}, Lcom/glympse/android/glympse/ViewSearch$PlacesAdapter;-><init>(Lcom/glympse/android/glympse/ViewSearch;Landroid/content/Context;Ljava/util/ArrayList;)V

    .line 175
    .local v2, oPlacesAdapter:Lcom/glympse/android/glympse/ViewSearch$PlacesAdapter;
    iget-object v3, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    invoke-virtual {v3, v2}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 176
    iget-object v3, p0, Lcom/glympse/android/glympse/ViewSearch;->m_oListResults:Landroid/widget/ListView;

    invoke-virtual {v3, v2}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 177
    return-void

    .line 169
    .end local v2           #oPlacesAdapter:Lcom/glympse/android/glympse/ViewSearch$PlacesAdapter;
    :cond_2
    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/glympse/platform/common/Place;

    .line 171
    .local v1, oPlace:Lcom/glympse/platform/common/Place;
    new-instance v4, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;

    sget-object v5, Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;->Place:Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;

    invoke-direct {v4, v5, v1}, Lcom/glympse/android/glympse/ViewSearch$PlaceItem;-><init>(Lcom/glympse/android/glympse/ViewSearch$PlaceItem$ETypes;Lcom/glympse/platform/common/Place;)V

    invoke-virtual {v0, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_0
.end method
